package com.sname.demofeign.service;

import com.sname.demofeign.entity.User;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * Created By  醉美柳舞之众星捧月
 *
 * @author 宋贤坤
 * @date 2018/11/19 17:38
 * <p>
 * 必要的注解    服务的名称(名称来源eureka上面的服务名称)
 * 指定fallback的类是哪个类
 * 在上面这个注解里面还可以添加configuration = xxxx.class这个参数列表
 * 作用是具体配置下跟Hystrix的具体参数
 */
@FeignClient(value = "DEMO-UPMS", fallback = FeignFallBack.class)
public interface FeignService {

    @RequestMapping("/hello")
    String hello();

    @RequestMapping(value = "/hello1", method = RequestMethod.GET)
    String hello(@RequestParam("name") String name);

    @RequestMapping(value = "/hello2", method = RequestMethod.GET)
    User hello(@RequestParam("name") String name, @RequestHeader("age") Integer age);

    @RequestMapping(value = "/hello3", method = RequestMethod.POST)
    String hello(@RequestBody User user);
}
